<p>循环语句不应该修改控制变量 </p>

<h2>不规范的代码示例</h2>
<pre> 
for (int i = 0; i &lt; 10; i++) {
  ...
  i = i - 1; // 不合规；计数器在循环主体中修改
  ...
} 
</pre>

<h2>正确的解决方案</h2>
<pre> 
for (int i = 0; i &lt; 10; i++) {...} 
</pre>

<h2>更多</h2>
<ul>
<li> MISRA C:2004, 13.6 - Numeric variables being used within a <em>for</em> loop for iteration counting shall not be modified in the body of the loop.
</li><li> MISRA C++:2008, 6-5-3 - The <em>loop-counter</em> shall not be modified within <em>condition</em> or <em>statement</em>.
</li></ul>

